package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.BindTeachplanMediaDto;
import com.xuecheng.content.model.dto.CourseTeacherDto;
import com.xuecheng.content.model.po.CourseTeacher;
import com.xuecheng.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "CourseTeacherController",tags = "查询教师列表")
@RestController
public class CourseTeacherController {
    @Autowired
    private CourseTeacherService courseTeacherService;
    /**
     * 查询教师列表
     * @param courseId
     * @return
     */
    @ApiOperation("查询课程师资列表")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> teacherList(@PathVariable Long courseId){
        return courseTeacherService.findCourseTeacherList(courseId);
    }
    @ApiOperation("添加,修改教师")
    @PostMapping("/courseTeacher")
    public CourseTeacher addTeacher(@RequestBody  CourseTeacherDto courseTeacherDto){
        Long companyId=1232141425L;
        return courseTeacherService.saveorEdit(companyId,courseTeacherDto);
    }
    @ApiOperation("删除教师")
    @DeleteMapping("/courseTeacher/course/{courseId}/{id}")
    public void deleteTeacher(@PathVariable Long courseId,@PathVariable Long id){
        Long companyId=1232141425L;
        courseTeacherService.deleteTeacher(companyId,courseId,id);
    }



}
